package com.situ.mall.product.controller;


import com.situ.mall.common.util.Result;
import com.situ.mall.pojo.entity.product.Collect;
import com.situ.mall.pojo.entity.product.Product;
import com.situ.mall.product.service.ICollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Sun Huijuan
 * @since 2024-10-17
 */
@RestController
@RequestMapping("/product/collect")
public class CollectController {
	@Autowired
	private ICollectService collectService;
	
	@GetMapping("/getCollect/{id}")
	public Result<List<Product>> getCollect(@PathVariable Long id){
		List<Product> list=collectService.getCollect(id);
		return Result.ok(list);
	}
	
	@PostMapping("/add")
	public Result add(@RequestBody Collect collect){
		collectService.save(collect);
		return Result.ok("添加成功！");
	}

}

